package com.share.bio;

import java.net.Socket;

/**
 * @author caifan
 * @createTime 2020/5/2
 * @desc bio 客户端
 */
public class SocketClient {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("127.0.0.1", 9400);
        //向服务端发送消息
        socket.getOutputStream().write("hello Server".getBytes());
        socket.getOutputStream().flush();
        System.out.println("发送给server end");
        byte[] buf = new byte[1024];
        //接收服务端数据
        socket.getInputStream().read(buf);

        socket.close();
    }
}
